<%--
  Created by IntelliJ IDEA.
  User: CY
  Date: 2018/1/4
  Time: 10:51
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>
<head>
    <title>小组初审</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8 ? MYOA_CHARSET : htmlspecialchars($HTML_PAGE_CHARSET))?>" />
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <%--<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">--%>
    <meta name="viewport" content="width=device-width, initial-scale=0.3, user-scalable=0, minimum-scale=0, maximum-scale=5.0,user-scalable=yes">+
    <link rel="stylesheet" type="text/css" href="/css/street/street.css"/>
    <link rel="stylesheet" href="/css/officialDocument/officialDocument.css">
    <link rel="stylesheet" href="/lib/pagination/style/pagination.css">
    <link rel="stylesheet" href="/lib/laydate/need/laydate.css">
    <link rel="stylesheet" href="/lib/layer/skin/default/layer.css">
    <%--<link rel="stylesheet" type="text/css" href="/css/patrol/patrol.css"/>--%>
    <link rel="stylesheet" href="/css/base.css">
    <script src="../js/jquery/jquery-1.9.1.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/layer/layer.js?20201106" type="text/javascript" charset="utf-8"></script>
<%--    <script src="/js/street/base/base.js" type="text/javascript" charset="utf-8"></script>--%>
    <script src="/js/base/base.js?20190927.1"></script>
    <script src="../lib/pagination/js/jquery.pagination.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="/js/base/tablePage.js"></script>
    <script src="/lib/laydate/laydate.js"></script>
    <script src="/lib/jquery.form.min.js"></script>
    <style>
        body{
            margin:0px;
        }
        .info{
            width:180px;
            height:28px;
            border-radius: 3px;
            margin-left:20px;
            vertical-align: middle;
        }
        button{
            background: #2f8ae3;
            margin-left: 10px;
            padding: 5px 10px;
            border-radius: 4px;
            color: #fff;
            cursor: pointer;
            font-size:14px;
        }
        #add{
            float:right;
            margin:0px 20px 0px 0px;
        }
        .table{
            width:96%;
            margin:5px auto 0px;
        }
        .tableFoot{
            margin-top:20px;
        }
        .childCheck{
            width:16px;
            vertical-align: middle;
        }
        #checkAll{
            margin-left:10px;
        }
        #outport{
            background: #cc0000;
        }
        #inportEdit{
            background: #009900;
        }
        .M-box3 .active{
            margin: 0px 3px;
            width: 29px;
            height: 29px;
            line-height: 29px;
            background: #2b7fe0;
            font-size: 12px;
            border: 1px solid #2b7fe0;
            color:#fff;
            text-align:center;
            display: inline-block;
        }
        .M-box3 a{
            margin: 0 3px;
            width: 29px;
            height: 29px;
            line-height: 29px;
            font-size: 12px;
            display: inline-block;
            text-align:center;
            background: #fff;
            border: 1px solid #ebebeb;
            color: #bdbdbd;
            text-decoration: none;
        }
        .mainBg .mainTitle{
            min-width: 750px;
        }
        .mainTitleUl .bordercolor span{
            font-size:14px;
        }
        .mainTitleUl .bordercolor label input[type=text]{
            font-size:14px;
        }
        .mainBg{
            padding-top:0px;
        }
        #houseProperty{
            background: none!important;
        }
        .ss div{
            height:25px;
            line-height:25px;
        }
    </style>
    <link rel="stylesheet" href="/css/biaodan.css">
</head>
<body>
<div class="headTop">
    <div class="headImg">
        <img src="/img/document/icon_agentDispatch.png" alt="">
    </div>
    <div class="divTitle">
        小组评审
    </div>
</div>
<div class="content" style="padding-top:55px;">
    <div class="tableList" >
        <div class="headNav">
            <%--<input type="text" class="info" placeholder="居委会名称">--%>
            <%--<button id="query">查询</button>--%>
            <%--<button id="inport">导入</button>--%>
            <%--<button id="inportEdit">导入修改</button>--%>
            <%--<button class="choose" id="add" data-type="0" style="margin-bottom: 10px;">新建</button>--%>
        </div>
        <div class="table">
            <table>
                <thead>
                <tr>
                    <%--<th style="width:1%"></th>--%>
                    <th>党支部</th>
                    <th>党员</th>
                    <th>活动主题</th>
                    <th>党支部初审</th>
                    <th>考核小组审核</th>
                    <th>分数</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody class="list">

                </tbody>
            </table>
            <%--<div class="tableFoot">--%>
            <%--<input type="checkbox" id="checkAll"  style="width:16px;vertical-align: middle">--%>
            <%--<label for="checkAll" style="font-size:14px;">全选</label>--%>
            <%--<button id="outport">导出</button>--%>
            <%--</div>--%>
            <div style="margin: 0px auto 0px;height:50px;width: 97%;" class="clearfix">
                <div id="dbgz_page" class="M-box3" style="display: none">

                </div>
            </div>
        </div>
    </div>
    <div class="mainBg" style="background: #fff;display: none">
        <form action="" id="datasave">
            <input type="file"  onchange="filesTwo(this)" multiple="multiple" name="file"
                   style="display: none"/>
            <div class="mainTitle">
                <ul class="mainTitleUl">
                    <li style="    padding-top: 18px;text-align: center;height: 61px;border-bottom: 1px solid #ddd"><span class="spanSize">积分管理信息表单</span> </li>
                    <li class="bordercolor clearfix">
                        <span style="border-bottom: 1px solid #fff;">党支部</span>
                        <label style="width: 80%;">
                            <select name="partyBranch" id="dang" style="width:92%;font-size:14px;background: none"></select>
                        </label>
                    </li>
                    <li class="bordercolor clearfix">
                        <span style="border-bottom: 1px solid #fff;">党员</span>
                        <label style="width: 80%;">
                            <input type="text" name="partyMember" placeholder="请填写党员" style="background: #fcfcfc;    width: 92%;
    float: none;
    margin-top: 9px;">
                        </label>
                    </li>
                    <li class="bordercolor clearfix">
                        <span style="border-bottom: 1px solid #fff;">活动主题</span>
                        <label style="width: 80%;">
                            <input type="text" name="activitySubject" placeholder="请填写活动主题" style="background: #fcfcfc;    width: 92%;
    float: none;
    margin-top: 9px;">
                        </label>
                    </li>

                    <li class="bordercolor clearfix">
                        <span style="border-bottom: 1px solid #fff;height: 105px;line-height: 105px">活动内容</span>
                        <label style="width: 80%;height: 105px;">
                            <textarea name="activityContent" id="activityContent"  placeholder="请填写活动内容" style="background: #fcfcfc;font-size:14px;margin-top:8px;"></textarea>
                        </label>
                    </li>
                    <li class="bordercolor clearfix">
                        <span style="border-bottom: 1px solid #fff;height: 100px;line-height: 100px">照片</span>
                        <label style="width: 80%;height: 100px;">
                            <div class="picture prevTwo" style="position: relative;width:88%">
                                <input type="hidden" name="attachmentId">
                                <img class="fl addPhotos" style="    width: 60px;cursor: pointer;
    height: 60px;
    margin-top: 4px;
    margin-right: 7px;" src="/img/grid/addtupin.png" alt="添加照片">
                                <input type="hidden" name="attachmentName">
                                <ul class="fl">
                                </ul>
                            </div>
                        </label>
                    </li>
                    <li class="bordercolor clearfix dzb">
                        <span style="border-bottom: 1px solid #fff;" class="hei">记分标准</span>
                        <label style="width: 80%;height: auto;" class="heiLabel">
                            <select name="" id="jifen" style="width:92%;font-size:14px;background: none"></select>
                            <input type="hidden" name="scoreStandard">
                            <div class="ss" style="display: flex;flex-wrap: wrap;"></div>
                        </label>
                    </li>


                    <li class="bordercolor clearfix dzb">
                        <span style="border-bottom: 1px solid #fff">分数</span>
                        <label>
                            <input type="text" name="scoreOld" placeholder="" style="margin: 9px auto 0px;float: none;">
                        </label>
                        <span class="kpxz">修改分数</span>
                        <label class="kpxz">
                            <input type="text" name="score" placeholder="请填写修改分数" style="margin: 9px auto 0px;float: none;">
                        </label>
                    </li>
                    <li class="bordercolor clearfix dzb">
                        <span style="border-bottom: 1px solid #fff;">党支部初审</span>
                        <label style="width: 80%;">

                            <label for="" style="width: 200px;font-size:14px;">通过
                                <input type="radio" name="partyBranchaudit" value="1" title="通过" style="width: 16px;margin-left: 4%;">
                            </label>
                            <label for="" style="width: 200px;font-size:14px;">不通过
                                <input type="radio" name="partyBranchaudit" value="2" title="不通过" style="width: 16px;margin-left: 15px;">
                            </label>
                            <%--<input type="hidden" name="status">--%>
                        </label>
                    </li>
                    <li class="bordercolor clearfix kpxz">
                        <span style="border-bottom: 1px solid #fff;">考评小组审核</span>
                        <label style="width: 80%;">

                            <label for="" style="width: 200px;font-size:14px;">通过
                                <input type="radio" name="assessmentTeamaudit" class="assessmentTeamaudit" value="1" style="width: 16px;;margin-left: 4%;">
                            </label>

                            <label for="" style="width: 200px;font-size:14px;">不通过
                                <input type="radio" name="assessmentTeamaudit" class="assessmentTeamaudit" value="2" style="width: 16px;margin-left: 15px;">
                            </label>
                            <input type="hidden" name="status">
                        </label>
                    </li>
                </ul>
                <div style="height: 88px;line-height: 88px;text-align: center">
                    <a href="javascript:void (0)" class="preservation" style="
                margin-top: 25px;display: inline-block;margin-right: 10px;
                line-height: 1;font-size:18px;padding: 8px 20px;
                background: #2F8AE3;color: #fff;border-radius: 6px">保存</a>
                    <a href="javascript:void (0)" class="getBack"  style="
                margin-top: 25px;display: inline-block;
                line-height: 1;font-size:18px;padding: 8px 20px;background: #2F8AE3;color: #fff;border-radius: 6px">返回</a>
                </div>
            </div>
        </form>
    </div>
</div>
<script>
    $(document).on('click','.choose',function(){
        var type=$(this).attr('data-type');
        // $('.tableList').hide();
        // $('.mainBg').show();
        if(type==0){//新建
            $('.tableList').hide();
            $('.mainBg').show();
            $('.preservation').attr('data-type','0');
            $('.preservation').show();
            $('.dzb').show();
            $('.kpxz').show();
            use();
            refresh()
            $('.addPhotos').show();
            $('#datasave').attr('action','/integralManger/addData')
        }else if(type==1){//查看
            var id=$(this).parents('tr').attr('id')
            $('.preservation').hide();
            $('.addPhotos').hide();
            $('.dzb').show();
            $('.kpxz').show();
            noUser();
            look(id,type)
            // detail(id,type)
        }else{//修改
            $('.tableList').hide();
            $('.mainBg').show();
            var id=$(this).parents('tr').attr('id')
            $('.preservation').attr('data-type','2');
            $('.preservation').attr('data-id',id);
            $('.preservation').show();
            $('.dzb').show();
            $('.kpxz').show();
            $('.addPhotos').hide();
            $('#datasave').attr('action','/integralManger/updateData?imid='+id)
            use();
            detail(id,type)
            $('#dang').attr('disabled','disabled');
            $('#jifen').attr('disabled','disabled');
            $('.check').attr('disabled','disabled')
            $('input[name="scoreOld"]').attr('disabled','disabled')
            $('input[name="partyBranchaudit"]').attr('disabled','disabled')
        }
    })
    //    点击返回
    $('.getBack').click(function(){
        $('.tableList').show();
        $('.mainBg').hide();
    })
    //    禁用
    function noUser(){
        $('.mainBg input[type="text"]').attr('disabled','disabled');
        $('.mainBg input[type="radio"]').attr('disabled','disabled');
        $('textarea').attr('disabled','disabled');
    }
    //    可以使用
    function use(){
        $('input[type="text"]').removeAttr('disabled');
        $('input[type="radio"]').removeAttr('disabled');
        $('textarea').removeAttr('disabled');
    }
    //    点击全选
    $('#checkAll').click(function(){
        var state=$(this).prop('checked');
        if(state == true){
            $(this).prop('checked',true);
            $('.childCheck').prop('checked',true);
        }else{
            $(this).prop('checked',false);
            $('.childCheck').prop('checked',false);
        }
    })

    $.get('/integralManger/getPartybranchData?deptId=1',function(res){
        var data=res.data;
        var str=""
        for(var i=0;i<data.length;i++){
            str += '<option value="'+data[i].orgDeptId+'">'+data[i].orgDeptName+'</option>'
        }
        $('#dang').html(str)
    })
    $.get('/code/getCode?parentNo=JFZB_TYPE',function (json) {
        if(json.flag){
            var str='<option value="">请选择</option>';
            for(var i=0;i<json.obj.length;i++){
                str+='<option type="'+(i+1)+'" value="'+json.obj[i].codeNo+'">'+json.obj[i].codeName+'</option>'
            }
            $('#jifen').html(str)
        }
    })
    $('#jifen').change(function(){
        var type=$('#jifen option:selected').attr('type');
        if(type!=undefined){
            // $('.mainTitleUl .bordercolor .heiLabel').css('height','260px');
            // $('.mainTitleUl .bordercolor .hei').css('height','260px');
            // $('.mainTitleUl .bordercolor .hei').css('line-height','260px')

        }else if(type==undefined){
//            $('.allCheck').html("") ;
//             $('.mainTitleUl .bordercolor .heiLabel').css('height','57px');
//             $('.mainTitleUl .bordercolor .hei').css('height','57px');
//             $('.mainTitleUl .bordercolor .hei').css('line-height','57px')
        }
        getScore(type);

    })


    function getScore(type){
        if(type!=undefined){
            $.get('/code/getCode?parentNo=JFZB_TYPE'+type ,function (json) {
                if(json.flag){
                    var str='';
                    for(var i=0;i<json.obj.length;i++){
                        str += '<div style="font-size:14px;text-align: left;margin-left:4%;"><input type="checkbox" style="float:none;width:16px;" class="check" value="'+json.obj[i].codeNo+'">'+json.obj[i].codeName+'</div>'
                    }
                    $('.ss').html(str)
                }
            })
        }else{
            $('.ss').html('')
        }

    }


    //    分页列表
    var ajaxPageLe={
        data:{
            page:1,//当前处于第几页
            pageSize:10,//一页显示几条
            useFlag:true,
            stepStatus:2,
            status:0
            // computationNumber:null
        },
        page:function () {
            var me=this;
            $.ajax({
                url:'/integralManger/getList',
                type:'get',
                data:me.data,
                dataType:'json',
                success:function(reg){
                    var datas=reg.data;


                    var str="";
                    for(var i=0;i<datas.length;i++){
                        var imgL=datas[i].attachmentList;
                        var img=""
                        for(var h=0;h<imgL.length;h++){
                            img +=   '<img src="/xs?'+imgL[h].attUrl+'" alt="" onclick="javascript:window.open(this.src)" style="width: 40px;height: 40px;margin-right: 10px;">'
                        }
                        str+='  <tr id="'+datas[i].imid+'">' +
                            '                    <td>'+function(){
                            if(datas[i].partyBranchName==undefined){
                                return ''
                            }else{
                                return datas[i].partyBranchName;
                            }
                            }()+'</td>' +
                            '                    <td>'+datas[i].partyMember+'</td>' +
                            '                    <td><a href="javascript:;" class="choose" data-type="1">'+datas[i].activitySubject+'</a></td>' +
                            '                    <td>'+datas[i].partyBranchaudit+'</td>' +
                            '                    <td>'+datas[i].assessmentTeamaudit+'</td>' +
                            '                    <td>'+datas[i].score+'</td>' +
                            '                    <td>' +
                            /*'                        <a href="javascript:;" class="choose" data-type="1">查看</a>' +*/
                            '                        <a href="javascript:;" class="choose" data-type="2">审核</a>' +
                            '                        <a href="javascript:;" class="del">删除</a>' +
                            '                    </td>' +
                            '                </tr>'
                    }
                    $('.list').html(str);
                    if(reg.total>10){
                        $('#dbgz_page').show();
                        me.pageTwo(reg.total,me.data.pageSize,me.data.page)
                    } else {
                        $('#dbgz_page').hide();
                    }
                }
            })

        },
        pageTwo:function (totalData, pageSize,indexs) {
            var mes=this;
            $('#dbgz_page').pagination({
                totalData: totalData,
                showData: pageSize,
                jump: true,
                coping: true,
                homePage:'',
                endPage: '',
                current:indexs||1,
                callback: function (index) {
                    mes.data.page=index.getCurrent();
                    mes.page();
                }
            });
        }
    }
    ajaxPageLe.page();

    //    点击删除
    $('.list').on('click','.del',function(){
        var id=$(this).parents('tr').attr('id')
        layer.confirm(' 确定要删除吗', {
            btn: ['确定', '取消'], //按钮
            title: " 删除"
        },function(){
            $.ajax({
                url:'/integralManger/deleteData',
                type:'post',
                dataType:'json',
                data:{id:id},
                success:function(){
                    layer.msg(' 删除成功', {icon: 6});
                    ajaxPageLe.page();
                }
            })
        }, function () {
            layer.closeAll();
        })
    })

    //    上传图片
    function filesTwo(mes) {
        var arr=mes.files;
        var bool=true;
        for(var i=0;i<arr.length;i++){
            if(arr[i].name.indexOf('.png')==-1&&arr[i].name.indexOf('.jpg')==-1&&arr[i].name.indexOf('.PNG')==-1&&arr[i].name.indexOf('.JPG')==-1){
                bool=false;
                break;
            }
        }
        if(!bool){
            $.layerMsg({content:'只能上传.png或.jpg格式！',icon:2});
            return
        }
        $('#datasave').prop('action','/flow/fileUpload?module=parameter')

        $('#datasave').ajaxSubmit({
            type:'post',
            dataType:'json',
            success:function (json) {
                if(json.flag) {
                    var str='';
                    var arr=json.datas;
                    var attStrId='';
                    var attStrName='';
                    for(var i=0;i<arr.length;i++){

//                        attStrId+=arr[i].attStrId+',';
//                        attStrName+=arr[i].attStrName+'*';
                        str+='<li class="pic" style="padding-left:10px;">' +
                            '<img src="/xs?'+arr[i].attUrl+'" alt="">' +
                            '<b class="deleClear">x</b>' +
                            '<input type="hidden" class="hiddenId" value="'+arr[i].attStrId+'">' +//id
                            '<input type="hidden" class="hiddenName" value="'+arr[i].attStrName+'">' +//名字
                            '</li>'
                    }
                    $(me).siblings('ul').append(str)
//                    $(me).prev().val(attStrId)
//                    $(me).next().val(attStrName)
                }else {
                    alert('异常')
                }

            }
        })

    }
    //    点击添加图片
    $('.addPhotos').click(function () {
        me=this;
        $('[name="file"]').click()
    })
    //    点击删除图片
    $(document).delegate('.deleClear','click',function () {
        $(this).parent().remove()
    })

    //    点击保存
    $('.preservation').click(function(){
        var type=$(this).attr('data-type');

        $('#dang').removeAttr('disabled');
        $('#jifen').removeAttr('disabled');
        $('.check').removeAttr('disabled')
        $('input[name="scoreOld"]').removeAttr('disabled')
        $('input[name="partyBranchaudit"]').removeAttr('disabled')


        var fen=$('#jifen option:selected').val();
//        console.log(fen)
        if(fen!=undefined){
            var strL=$('.check:checked').length;
            var str=fen+','
            $('.check:checked').each(function(){
                str += $(this).val()+',';
            })
            $('input[name="scoreStandard"]').val(str);
            console.log($('input[name="scoreStandard"]').val())
        }else{
            $('input[name="scoreStandard"]').val('');
        }

        $('input[name="status"]').val($('.assessmentTeamaudit:checked').val())

        if(type==0){//新建
            $('#datasave').attr('action','/visitrecords/addRecords')
            var attIdLen=$('.hiddenId').length;
            var attNameLen=$('.hiddenName').length;
            var attId="";
            var attName="";
            for(var i=0;i<attIdLen;i++){
                attId += $('.hiddenId').eq(i).attr('value')+','
            }
            for(var i=0;i<attNameLen;i++){
                attName += $('.hiddenName').eq(i).attr('value')+'*'
            }
            $('input[name="attachmentId"]').val(attId)//图片id
            $('input[name="attachmentName"]').val(attName)//图片名称
            $('#datasave').ajaxSubmit({
                type:'post',
                dataType:'json',
                success:function(res){
                    if(res.flag){
                        $.layerMsg({content:'新建成功',icon:1})
                        $('.tableList').show();
                        $('.mainBg').hide();
                        ajaxPageLe.data.page=1;
                        ajaxPageLe.page();
                    }else{
                        $.layerMsg({content:'新建失败',icon:1})
                    }
                }
            })
        }else if(type==2){
            var id=$(this).attr('data-id')
            $('#datasave').attr('action','/integralManger/updateData?imid='+id)
            var attIdLen=$('.hiddenId').length;
            var attNameLen=$('.hiddenName').length;
            var attId="";
            var attName="";
            for(var i=0;i<attIdLen;i++){
                attId += $('.hiddenId').eq(i).attr('value')+','
            }
            for(var i=0;i<attNameLen;i++){
                attName += $('.hiddenName').eq(i).attr('value')+'*'
            }
            $('input[name="attachmentId"]').val(attId)//图片id
            $('input[name="attachmentName"]').val(attName)//图片名称
            $('#datasave').ajaxSubmit({
                type:'post',
                dataType:'json',
                success:function(res){
                    if(res.flag){
                        $.layerMsg({content:'修改成功',icon:1})
                        $('.tableList').show();
                        $('.mainBg').hide();
                        ajaxPageLe.data.page=1;
                        ajaxPageLe.page();
                    }else{
                        $.layerMsg({content:'修改失败',icon:1})
                    }
                }
            })
        }
    })

    //    查看详情
    function  detail(id,type) {
        $.ajax({
            url:'/integralManger/getDataById',
            data:{id:id},
            dataType:'json',
            type:'get',
            success:function(res){
                var data=res.data;
                $('#dang').val(data.partyBranch);//居委会名称
                $('input[name="partyMember"]').val(data.partyMember)//房屋住址
//
                $('input[name="activitySubject"]').val(data.activitySubject);//所有者姓名
                $('#activityContent').val(data.activityContent);//所有者身份证号


                //                    图片显示
                var obj=data.attachmentList;
                var str1=""
                for(var i=0;i<obj.length;i++){
                    str1+='<li class="pic" style="padding-left:10px;">' +
                        '<img src="/xs?'+obj[i].attUrl+'" alt=""  style="cursor:pointer"><input type="hidden" class="hiddenId"  value="'+obj[i].aid+'@'+obj[i].ym+'_'+obj[i].attachId+'">' +//id
                        '<input type="hidden"  class="hiddenName" value="'+obj[i].attachName+'">' +//名字
                        '</li>'
                }
                $('.prevTwo>ul').html(str1);
                $('input[name="attachmentId"]').val(data.attachmentId)
                $('input[name="attachmentName"]').val(data.attachmentName)
                var arr=[];
                arr=data.scoreStandard.split(',');
                var arr1=arr.pop();
                var first=arr.shift();

                $('#jifen').val(first);
                var type=$('#jifen option:selected').attr('type');

                if(type!=undefined){
                    $.get('/code/getCode?parentNo=JFZB_TYPE'+type ,function (json) {
                        var str = ''
                        if(json.flag){
                            for(var i=0;i<json.obj.length;i++){
                                str += '<div style="    margin-left: 4%;\n' +
                                    '    margin-right: 8%;\n' +
                                    '    margin-top: 15px;">' +
                                    '<div>' +
                                    '<input type="checkbox" style="float:none;width:16px;" class="check" value="'+json.obj[i].codeNo+'">'+json.obj[i].codeName+'' +
                                    '</div>' +
                                    '</div>'
                            }
                            $('.ss').html(str)
                            for(var i=0;i<arr.length;i++){
                                $('.check').each(function(){
                                    if($(this).val()==arr[i]){
                                        $(this).prop('checked',true)
                                    }
                                })
                            }

                        }
                    })
                }else{
                    $('.ss').html('')
                }
                $('input[name="scoreOld"]').val(data.score)
//                $('input[name="score"]').val(data.score)
                check('partyBranchaudit',data.partyBranchaudit)





            }
        })
    }

    function look(id,type) {
        $.ajax({
            url:'/integralManger/getDataById',
            data:{id:id},
            dataType:'json',
            type:'get',
            success:function(res){
                var data=res.data;
                //图片显示
                var obj=data.attachmentList;
                var str1=""
                var str = '';
                var str3 = '';
                for(var i=0;i<obj.length;i++){
                    str1+='<li class="pic" style="padding-left:10px;">' +
                        '<img src="/xs?'+obj[i].attUrl+'" alt=""  style="cursor:pointer"><input type="hidden" class="hiddenId"  value="'+obj[i].aid+'@'+obj[i].ym+'_'+obj[i].attachId+'">' +//id
                        '<input type="hidden"  class="hiddenName" value="'+obj[i].attachName+'">' +//名字
                        '</li>'
                }
                $('.prevTwo>ul').html(str1);
                $('input[name="attachmentId"]').val(data.attachmentId)
                $('input[name="attachmentName"]').val(data.attachmentName)
                var arr=[];
                arr=data.scoreStandard.split(',');
                var arr1=arr.pop();
                var first=arr.shift();

                $('#jifen').val(first);
                var type=$('#jifen option:selected').attr('type');

                if(type!=undefined){
                    $.get('/code/getCode?parentNo=JFZB_TYPE'+type ,function (json) {
                        if(json.flag){
                            for(var i=0;i<json.obj.length;i++){
                                str3 += '<div style="    margin-left: 4%;\n' +
                                    '    margin-right: 8%;\n' +
                                    '    margin-top: 15px;">' +
                                    '<div>' +
                                    '<input type="checkbox" style="float:none;width:16px;" class="check" value="'+json.obj[i].codeNo+'">'+json.obj[i].codeName+'' +
                                    '</div>' +
                                    '</div>'
                            }
                            $('.ss').html(str3)
                            for(var i=0;i<arr.length;i++){
                                $('.check').each(function(){
                                    if($(this).val()==arr[i]){
                                        $(this).prop('checked',true)
                                    }
                                })
                            }

                        }
                    })
                }else{
                    $('.ss').html('')
                }

                    $('input[name="scoreOld"]').val(data.score)
                    check('partyBranchaudit', data.partyBranchaudit)


                layer.open({
                    type: 1,
                    title: '详情',
                    // shade: 0.5,
                    area: ['60%', '80%'],
                    btn:['关闭'],
                    content:'<div class="mainBg" style="background: #fff;">\n' +
                        '        <form action="" id="datasave">\n' +
                        '            <input type="file"  onchange="filesTwo(this)" multiple="multiple" name="file"\n' +
                        '                   style="display: none"/>\n' +
                        '            <div class="mainTitle" style="background: #f6f6f6;border: none">\n' +
                        '                <ul class="mainTitleUl">\n' +
                        '                    <li class="bordercolor clearfix" style="    padding:0 !important;text-align: center;border-bottom: none !important;height:auto !important;">\n' +
                        '                        <span style="text-align: right;">党支部</span>\n' +
                        '                        <label style="width: 80%;">\n' +
                        '                            <input type="text" value="'+data.partyBranchName+'" name="partyBranch" id="dang" style="width:85%;margin-left:6%;  font-size:14px;"></input>\n' +
                        '                        </label>\n' +
                        '                    </li>\n' +
                        '                    <li class="bordercolor clearfix">\n' +
                        '                        <span style="border-bottom: 1px solid #fff;">党员</span>\n' +
                        '                        <label style="width: 80%;">\n' +
                        '                            <input type="text" value="'+data.partyMember+'" name="partyMember" placeholder="请填写党员" style="background: #fcfcfc;    width: 92%; float: none;  margin-top: 9px;">\n' +
                        '                        </label>\n' +
                        '                    </li>\n' +
                        '                    <li class="bordercolor clearfix">\n' +
                        '                        <span style="border-bottom: 1px solid #fff;">活动主题</span>\n' +
                        '                        <label style="width: 80%;">\n' +
                        '                            <input type="text" value="'+data.activitySubject+'" name="activitySubject" placeholder="请填写活动主题" style="background: #fcfcfc;    width: 92%;  float: none;margin-top: 9px;">\n' +
                        '                        </label>\n' +
                        '                    </li>\n' +
                        '                    <li class="bordercolor clearfix">\n' +
                        '                        <span style="border-bottom: 1px solid #fff;height: 105px;line-height: 105px">活动内容</span>\n' +
                        '                        <label style="width: 80%;height: 105px;">\n' +
                        '                            <textarea name="activityContent" id="activityContent"  placeholder="请填写活动内容" style="background: #fcfcfc;font-size:14px;margin-top:8px;">'+data.activityContent+'</textarea>\n' +
                        '                        </label>\n' +
                        '                    </li>\n' +
                        '                    <li class="bordercolor clearfix">\n' +
                        '                        <span style="border-bottom: 1px solid #fff;height: 100px;line-height: 100px">照片</span>\n' +
                        '                        <label style="width: 80%;height: 100px;">\n' +
                        '                            <div class="picture prevTwo" style="position: relative;width:88%">\n' +
                        '                                <input type="hidden" name="attachmentId">\n' +
                        // '                                <img class="fl addPhotos" style="    width: 60px;cursor: pointer; height: 60px; margin-top: 4px; margin-right: 7px;" src="/img/grid/addtupin.png" alt="添加照片">\n' +
                        '                                <input type="hidden" name="attachmentName">\n' +
                        '                                <ul class="fl">'+str1+' </ul>\n' +
                        '                            </div>\n' +
                        '                        </label>\n' +
                        '                    </li>\n' +
                        '                    <li class="bordercolor clearfix dzb">\n' +
                        '                        <span style="border-bottom: 1px solid #fff;" class="hei">记分标准</span>\n' +
                        '                        <label style="width: 80%;height: auto;" class="heiLabel">\n' +
                        '                            <select name="" id="jifen" style="width:92%;font-size:14px;background: none"></select>\n' +
                        '                            <input type="hidden" name="scoreStandard">\n' +
                        '                            <div class="ss" style="display: flex;flex-wrap: wrap;">'+str3+'</div>\n' +
                        '                        </label>\n' +
                        '                    </li>\n' +
                        '                    <li class="bordercolor clearfix dzb">\n' +
                        '                        <span style="border-bottom: 1px solid #fff">分数</span>\n' +
                        '                        <label>\n' +
                        '                            <input type="text" value="'+data.score+'" name="scoreOld" placeholder="" style="margin: 9px auto 0px;float: none;">\n' +
                        '                        </label>\n' +
                        '                        <span class="kpxz">修改分数</span>\n' +
                        '                        <label class="kpxz">\n' +
                        '                            <input type="text"  name="score" placeholder="请填写修改分数" style="margin: 9px auto 0px;float: none;">\n' +
                        '                        </label>\n' +
                        '                    </li>\n' +
                        '                    <li class="bordercolor clearfix dzb">\n' +
                        '                        <span style="border-bottom: 1px solid #fff;">党支部初审</span>\n' +
                        '                        <label style="width: 80%;">\n' +
                        '                            <label for="" style="width: 200px;font-size:14px;">\n' +
                        '                                <input type="text" name="partyBranchaudit" value="'+data.partyBranchaudit+'" title="通过" style="margin-left: 4%;">\n' +
                        '                            </label>\n' +
                        // '                            <label for="" style="width: 200px;font-size:14px;">不通过\n' +
                        // '                                <input type="radio" name="partyBranchaudit" value="2" title="不通过" style="width: 16px;margin-left: 15px;">\n' +
                        // '                            </label>\n' +
                        '                        </label>\n' +
                        '                    </li>\n' +
                        '                    <li class="bordercolor clearfix kpxz">\n' +
                        '                        <span style="border-bottom: 1px solid #fff;">考评小组审核</span>\n' +
                        '                        <label style="width: 80%;">\n' +
                        '                            <label for="" style="width: 200px;font-size:14px;">\n' +
                        '                                <input type="text" name="assessmentTeamaudit" class="assessmentTeamaudit" value="'+data.assessmentTeamaudit+'" style="margin-left: 4%;">\n' +
                        '                            </label>\n' +
                        // '                            <label for="" style="width: 200px;font-size:14px;">不通过\n' +
                        // '                                <input type="radio" name="assessmentTeamaudit" class="assessmentTeamaudit" value="2" style="width: 16px;margin-left: 15px;">\n' +
                        // '                            </label>\n' +
                        '                            <input type="hidden" name="status">\n' +
                        '                        </label>\n' +
                        '                    </li>\n' +
                        '                </ul>\n' +
                        '            </div>\n' +
                        '        </form>\n' +
                        '    </div>',
                    success:function(res){
                        $('input').css('border','none')
                        $('input').attr('readonly','readonly')
                    }
                    ,yes: function(index, layero){
                        layer.close(index)
                        $('input').css('border','1px solid #DFE4EB')
                        $('input[type="text"]').removeAttr('readonly');
                    }
                })

            }
        })

    }
    //    ridio check
    function check(name,data){
        $(':radio[name="'+name+'"][title="'+data+'"]').prop('checked','check')
    }
//    function checkbox(arr){
//            for(var i=0;i<arr.length;i++){
//                $('.check[value="'+arr[i]+'"]').prop('checked','checked')
//            }
//        }

    //    点击查询
    $('#query').click(function(){
        ajaxPageLe.data.committeeName =$('.info').val();
        ajaxPageLe.page();
    })

    //    点击导入
    $('#inport').click(function(){
        layer.open({
            type:1,
            title: ['开墙打洞(经营)信息导入', 'background-color:#2b7fe0;color:#fff;'],
            area: ['600px', '420px'],
            btn: ['导入', '取消'],
            content:'<div>' +
            '<form class="form1" name="form1" id="uploadForm" method="post" action="/enOpenHole/importEnOpenHole" enctype="multipart/form-data">' +
            '<table class="importTable"> ' +
            '<tr><td style="width: 100px;">下载导入模板：</td><td style="text-align: left;"><a id="model" style="cursor:pointer">开墙打洞(经营)信息模板下载</a></td></tr>' +
            '<tr> <td>选择导入文件：</td> <td><input style="width: auto" type="file" name="file"/></td> </tr>' +
            '<tr>' +
            '<td>说明：</td>'+
            '<td style="text-align: left;"><p>1、请导入.xls文件或者.xlsx。</p>'+
//            '<p>2、请填写网格信息中已有网格。</p>'+
            ' </td> ' +
            '</tr>' +
            '</table>' +
            '</form>' +
            '</div>',
            success:function(){
                $('#model').click(function () {
                    window.location.href = encodeURI("/file/grid/business_account.xls");
                });
            },
            yes:function(obj){
                var flag = CheckForm();
                if (flag) {
                    layer.msg("正在导入中，请耐心等候", {icon: 1});
                    $.upload($('#uploadForm'), function (res) {
                        if(res.flag) {
                            layer.msg("导入成功", {icon: 1});
                        }else{
                            layer.msg("导入失败", {icon: 2});
                        }
                    });

                    layer.closeAll();
                }
            }
        })
    })
    function CheckForm(){
        if(document.form1.file.value==""){
            layer.msg("请导入至少一条数据！",{icon:2});
            return (false);
        }
        return (true);
    }

    //    点击导出
    $('#outport').click(function(){
        if($('.childCheck:checked').length<=0){
            $.layerMsg({content:'请选择至少一条数据',icon:6})
        }else{
            var arr=[]
            $('.childCheck:checked').each(function(){
                var id=$(this).parents('tr').attr('id');
                arr.push(id)
            })
//            var str=arr.join()
//             console.log(arr)
            window.location.href= '<%=basePath%>/enHoleBusiness/queryList?manyId='+arr+'&export=1';
        }

    })

    //    重置
    function refresh(){
        $('#dang').val('');//居委会名称
        $('input[name="partyMember"]').val('')//房屋住址
//
        $('input[name="activitySubject"]').val('');//所有者姓名
        $('#activityContent').val('');//所有者身份证号
        $('.prevTwo>ul').html("")
        $('input[name="partyBranchaudit"]').prop('checked',false)
        $('input[name="assessmentTeamaudit"]').prop('checked',false)
        $('.ss').html('');
        $('#jifen').val('')
        $('.mainTitleUl .bordercolor .heiLabel').css('height','57px');
        $('.mainTitleUl .bordercolor .hei').css('height','57px');
        $('.mainTitleUl .bordercolor .hei').css('line-height','57px')
    }

    $(document).on('click','.pic img',function () {

        var imgs=$(this).attr('src')
        var wt=$(document.body).width()-800
        var ht=$(document.body).height()-500
        layer.open({
            type: 1,
            title: false,
            closeBtn: 0,
            area: ['auto'],
            offset:'100px',
            skin: 'layui-layer-nobg', //没有背景色
            shadeClose: true,
            content:
            '<img src="'+imgs+'" width="'+wt+'" height="'+ht+'">'
        });
    })

    // $(document).on('click','.layui-layer-content',function () {
    //     layer.closeAll()
    // })


</script>
</body>
</html>
